package com.example.demo.dao;

import com.example.demo.entity.SysOrderQrcode;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface SysOrderQrcodeMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order_qrcode
     *
     * @mbg.generated
     */
    @Delete({
        "delete from sys_order_qrcode",
        "where order_id = #{orderId,jdbcType=INTEGER}",
          "and scene = #{scene,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(@Param("orderId") Integer orderId, @Param("scene") Integer scene);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order_qrcode
     *
     * @mbg.generated
     */
    @Insert({
        "insert into sys_order_qrcode (order_id, scene, ",
        "code, `state`)",
        "values (#{orderId,jdbcType=INTEGER}, #{scene,jdbcType=INTEGER}, ",
        "#{code,jdbcType=VARCHAR}, #{state,jdbcType=BIT})"
    })
    int insert(SysOrderQrcode record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order_qrcode
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "order_id, scene, code, `state`",
        "from sys_order_qrcode",
        "where order_id = #{orderId,jdbcType=INTEGER}",
          "and scene = #{scene,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="scene", property="scene", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
        @Result(column="state", property="state", jdbcType=JdbcType.BIT)
    })
    SysOrderQrcode selectByPrimaryKey(@Param("orderId") Integer orderId, @Param("scene") Integer scene);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order_qrcode
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "order_id, scene, code, `state`",
        "from sys_order_qrcode"
    })
    @Results({
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="scene", property="scene", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
        @Result(column="state", property="state", jdbcType=JdbcType.BIT)
    })
    List<SysOrderQrcode> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_order_qrcode
     *
     * @mbg.generated
     */
    @Update({
        "update sys_order_qrcode",
        "set code = #{code,jdbcType=VARCHAR},",
          "`state` = #{state,jdbcType=BIT}",
        "where order_id = #{orderId,jdbcType=INTEGER}",
          "and scene = #{scene,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysOrderQrcode record);
}